home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / gcc / geninline_920614.lha / inline-2.0 / timer.h < prev    next >
C/C++ Source or Header  |  1992-06-14  |  3KB  |  95 lines

  1. #ifndef _INLINE_TIMER_H
  2. #define _INLINE_TIMER_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL extern struct Device * TimerBase;
  11. #endif
  12. #ifndef BASE_PAR_DECL
  13. #define BASE_PAR_DECL
  14. #define BASE_PAR_DECL0 void
  15. #endif
  16. #ifndef BASE_NAME
  17. #define BASE_NAME TimerBase
  18. #endif
  19.  
  20. static __inline void 
  21. AddTime (BASE_PAR_DECL struct timeval *dest,struct timeval *src)
  22. {
  23.   BASE_EXT_DECL
  24.   register struct Device *a6 __asm("a6") = BASE_NAME;
  25.   register struct timeval *a0 __asm("a0") = dest;
  26.   register struct timeval *a1 __asm("a1") = src;
  27.   __asm __volatile ("jsr a6@(-0x2a)"
  28.   : /* no output */
  29.   : "r" (a6), "r" (a0), "r" (a1)
  30.   : "a0","a1","d0","d1");
  31.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  32. }
  33. static __inline LONG 
  34. CmpTime (BASE_PAR_DECL struct timeval *dest,struct timeval *src)
  35. {
  36.   BASE_EXT_DECL
  37.   register LONG  _res  __asm("d0");
  38.   register struct Device *a6 __asm("a6") = BASE_NAME;
  39.   register struct timeval *a0 __asm("a0") = dest;
  40.   register struct timeval *a1 __asm("a1") = src;
  41.   __asm __volatile ("jsr a6@(-0x36)"
  42.   : "=r" (_res)
  43.   : "r" (a6), "r" (a0), "r" (a1)
  44.   : "a0","a1","d0","d1");
  45.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  46.   return _res;
  47. }
  48. static __inline void 
  49. GetSysTime (BASE_PAR_DECL struct timeval *dest)
  50. {
  51.   BASE_EXT_DECL
  52.   register struct Device *a6 __asm("a6") = BASE_NAME;
  53.   register struct timeval *a0 __asm("a0") = dest;
  54.   __asm __volatile ("jsr a6@(-0x48)"
  55.   : /* no output */
  56.   : "r" (a6), "r" (a0)
  57.   : "a0","a1","d0","d1");
  58.   *(char *)a0 = *(char *)a0;
  59. }
  60. static __inline ULONG 
  61. ReadEClock (BASE_PAR_DECL struct EClockVal *dest)
  62. {
  63.   BASE_EXT_DECL
  64.   register ULONG  _res  __asm("d0");
  65.   register struct Device *a6 __asm("a6") = BASE_NAME;
  66.   register struct EClockVal *a0 __asm("a0") = dest;
  67.   __asm __volatile ("jsr a6@(-0x3c)"
  68.   : "=r" (_res)
  69.   : "r" (a6), "r" (a0)
  70.   : "a0","a1","d0","d1");
  71.   *(char *)a0 = *(char *)a0;
  72.   return _res;
  73. }
  74. static __inline void 
  75. SubTime (BASE_PAR_DECL struct timeval *dest,struct timeval *src)
  76. {
  77.   BASE_EXT_DECL
  78.   register struct Device *a6 __asm("a6") = BASE_NAME;
  79.   register struct timeval *a0 __asm("a0") = dest;
  80.   register struct timeval *a1 __asm("a1") = src;
  81.   __asm __volatile ("jsr a6@(-0x30)"
  82.   : /* no output */
  83.   : "r" (a6), "r" (a0), "r" (a1)
  84.   : "a0","a1","d0","d1");
  85.   *(char *)a0 = *(char *)a0;  *(char *)a1 = *(char *)a1;
  86. }
  87. #undef BASE_EXT_DECL
  88. #undef BASE_PAR_DECL
  89. #undef BASE_PAR_DECL0
  90. #undef BASE_NAME
  91.  
  92. __END_DECLS
  93.  
  94. #endif /* _INLINE_TIMER_H */
  95.